using UnityEngine;

public class CourtStateOpening : AbstractCourtState
{
	private static CourtStateOpening instance;

	private CourtStateOpening()
	{
	}

	public static CourtStateOpening getInstance()
	{
		if (instance == null)
		{
			instance = new CourtStateOpening();
		}
		return instance;
	}

	public override void enter(Court owner)
	{
		base.enter(owner);
		Instance<CameraController>.instance.myAnimation.Play(AnimationName.camera_opencourt);
		Instance<UIGame>.instance.show_playing();
		Instance<Referee>.instance.do_opening();
		owner.teamUser.OnOpening();
		owner.teamComputer.OnOpening();
		owner.resetQuarterTime();
		owner.count_ReadyToJumpBall = 0;
		Instance<UIGame>.instance.isLockPauseBtn = true;
		Instance<UIGame>.instance.isLockPassBtn = true;
		Instance<UIGame>.instance.isLockShootBtn = true;
		Instance<UIGame>.instance.isLockJoystick = true;
	}

	public override void update(Court owner, float deltaTime)
	{
		base.update(owner, deltaTime);
		if (owner.count_ReadyToJumpBall == 10)
		{
			owner.do_jumpball();
		}
		if (Global.isAndroid)
		{
			if (UnityEngine.Input.touchCount > 0)
			{
				owner.do_jumpball();
			}
		}
		else if (Input.GetMouseButtonDown(0))
		{
			owner.do_jumpball();
		}
	}
}
